import request from '@/utils/request';

/**
 * 登录
 *
 * @param {}.account 帐号
 * @param {}.password 密码
 * @returns Promise
 *
 * @todo 发起axios请求
 */
export const login = (data: API.auth.LoginDto) => {
  return request<API.auth.LoginSchema>({
    url: '/auth/login',
    method: 'post',
    data
  });
};

/**
 * 获取登录信息
 */
export const getProfile = () => {
  return request({
    // url: '/account/info',
    url: '/auth/profile',
    method: 'get'
  });
};

/**
 * 获取路由及权限
 *
 * @returns Promise
 *
 * @todo 发起axios请求
 */
export const getRoutes = () => {
  return request<API.auth.RouteSchema[]>({
    url: '/admin/route',
    method: 'get'
  });
};
